package goods

import (
	"orm_gin/model"
	"orm_gin/orm"
	"orm_gin/utools/res"

	"github.com/gin-gonic/gin"
)

func UpdateGoods(c *gin.Context) {
	var update model.UserGoods
	// var goods model.UserGoods
	err := c.BindJSON(&update)
	if err != nil {
		res.Error(c, 0, err, "传入参数有误")
		return
	}

	r := orm.DB.Model(&model.UserGoods{}).Where("id=?", update.ID).Update("goods_name", update.GoodsName)

	if r.Error != nil {
		res.Error(c, 0, err, "数据修改失败！")
		return
	}

	res.Ok(c, nil, "操作成功")
}
